home *** CD-ROM | disk | FTP | other *** search
/ macdrivermuseum.net / www.macdrivermuseum.net.tar / www.macdrivermuseum.net / nic / cabletron.sit / Cabletron Ethertalk Installer / aux_dni / startup_cs.Z / startup_cs
Text File  |  1992-01-12  |  3KB  |  134 lines

  1. #!/bin/sh
  2. #
  3. #    startup cs
  4. #
  5. #     @(#)Copyright Apple Computer 1987-89
  6. #    Copyright Cabletron Systems 1989-90
  7. #     Version 0.0.1 of cs on 7/10/90 
  8. #
  9. #    This initializes the Cabletron cs DNI  network interface.
  10. #
  11.  
  12. PATH=/bin:/usr/bin:/etc:/usr/etc
  13. ScriptName=$0
  14.  
  15. #
  16. #    main program
  17. #
  18.  
  19. #
  20. #    parse the "-i" flag
  21. #
  22. if [ "$1" = "-i" ]; then    
  23.     InstFlag=1
  24.     shift
  25. else
  26.     InstFlag=0
  27. fi
  28.  
  29. #
  30. #    check to see if an ethernet card is actually installed
  31. #
  32. #/etc/etheraddr > /dev/null
  33. #status=$?
  34. #if [ $status -ne 0 ]; then
  35. #    echo 'No Ethernet card(s) installed.'
  36. #    exit 0
  37. #fi
  38.  
  39. if [ $InstFlag = 1 ]; then
  40.     sh /etc/sethost
  41. fi
  42.  
  43. if [ -f /etc/HOSTNAME ]; then
  44.     read host domain < /etc/HOSTNAME
  45. else
  46.     host=`/bin/hostname`
  47. fi
  48.  
  49. #
  50. #    Get the network info for each cs board in the system
  51. #
  52. while [ $# != 0 ]; do
  53.     case $1 in
  54.     -C) (
  55.     maxdev=$2    # max number of devices (boards)
  56.         echo " $maxdev Ethernet card(s) installed"
  57.     unit=0
  58.         if [ ! -f /etc/NETADDRS ]; then
  59.       # get pertinent information and set up data base for first time
  60.       while [ "$unit" -lt "$maxdev" ]; do
  61.         while [ "$inetaddr" = "" ]; do
  62.               echo "cs$unit: Please enter an Internet address: \c"
  63.               read inetaddr
  64.         done
  65.         while [ "$broadcast" = "" ]; do
  66.               echo "cs$unit: Please enter an Internet Broadcast address: \c"
  67.               read broadcast
  68.         done
  69.             echo "cs$unit: Please enter a netmask [none]: \c"
  70.             read netmask
  71.         if [ "$netmask" = "none" ]; then
  72.           netmask=
  73.         fi
  74.         echo "cs$unit    $inetaddr $broadcast $netmask" >> /etc/NETADDRS
  75.               echo "$inetaddr $host # `/bin/date`" >> /etc/hosts
  76.         unit=`expr $unit + 1`
  77.         inetaddr=; broadcast=;
  78.       done
  79.     fi
  80.  
  81.     # go through /etc/NETADDRS data base, filling in info for new cards
  82.     # allow for possibility (though undesirable) of line containing only
  83.     # unit number
  84.     unit=0
  85.     while [ "$unit" -lt "$maxdev" ]; do
  86.       set ''`/bin/sed -n "/^[     ]*cs$unit/p" /etc/NETADDRS`
  87.       n=$#
  88.       inetaddr=$2; broadcast=$3; netmask=$4
  89.       while [ "$inetaddr" = "" ]; do
  90.             echo "cs$unit: Please enter an Internet address: \c"
  91.             read inetaddr
  92.       done
  93.       while [ "$broadcast" = "" ]; do
  94.             echo "cs$unit: Please enter an Internet Broadcast address: \c"
  95.             read broadcast
  96.       done
  97.       if [ "$n" -lt 2 ]; then
  98.         # first time for this card; ask for netmask
  99.             echo "cs$unit: Please enter a netmask [none]: \c"
  100.             read netmask
  101.         if [ "$netmask" = "none" ]; then
  102.           netmask=
  103.         fi
  104.         echo "cs$unit    $inetaddr $broadcast $netmask" >> /etc/NETADDRS
  105.               echo "$inetaddr $host # `/bin/date`" >> /etc/hosts
  106.       fi
  107.       
  108.           echo "cs$unit: hostname is $host with IP address of $inetaddr \c"
  109.       echo "broadcasting with $broadcast"
  110.           if [ $InstFlag = 0 ]; then
  111.         if [ -n "$netmask" ]; then
  112.               /etc/ifconfig cs$unit "$inetaddr" broadcast "$broadcast" netmask \
  113.              "$netmask" -trailers
  114.         else
  115.               /etc/ifconfig cs$unit "$inetaddr" broadcast "$broadcast" -trailers
  116.         fi
  117.             /etc/ifconfig  cs$unit
  118.           fi
  119.  
  120.       unit=`expr $unit + 1`
  121.     done
  122.  
  123.         )
  124.     ;;
  125.  
  126.     -D)    ;;
  127.     -S)    ;;
  128.      *)    echo "$ScriptName:  unexpected argument:  $1"
  129.       exit 1
  130.         ;;
  131.     esac
  132.     shift 2
  133. done
  134.